/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swing.tree;

import java.awt.BorderLayout;
import javax.swing.DefaultCellEditor;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.tree.TreeCellEditor;

/**
 *
 * @author Administrator
 */
public class TreeEdit
{

  public static void main(String[] args)
  {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//    DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
//    DefaultMutableTreeNode parent = new DefaultMutableTreeNode("parent");
//    root.insert(parent, 0);

    Object array[] =
    {
      Boolean.TRUE, Boolean.FALSE, "Hello"
    };
    JTree tree = new JTree(array);
    tree.setEditable(true);
    tree.setRootVisible(true);

    JCheckBox check = new JCheckBox();
    TreeCellEditor cellEdit = new DefaultCellEditor(check);
    tree.setCellEditor(cellEdit);

    JScrollPane pane = new JScrollPane(tree);
    frame.add(pane, BorderLayout.CENTER);


    frame.setSize(300, 400);
    frame.setVisible(true);
  }
}
